from django.db import models
from django.utils.translation import ugettext_lazy as _
# Create your models here.

class category(models.Model):
    CATE_CHOICES = (
        (1, _('AutoAnalyze')),
        (2, _('SingleAdd')),
    )
    link_name       = models.CharField(_('name'), max_length=200)
    link_url        = models.CharField(_('title'), max_length=200)
    category_class  = models.IntegerField(_('classification'), choices=CATE_CHOICES, default=2)
    
    def __unicode__(self):
        return self.link_name
    
class category_page(models.Model):
    link_name       = models.CharField(_('link name'), max_length=200)
    link_url        = models.CharField(_('link url'), max_length=200)
    category_id     = models.ForeignKey(category, related_name="%(app_label)s_%(class)s_related", verbose_name="category id")
    analyzed        = models.BooleanField(_('has analyzed'), default=False)
    
    def __unicode__(self):
        return self.link_name
    
class article(models.Model):
    link_name       = models.CharField(_('link name'), max_length=200)
    link_url        = models.CharField(_('link url'), max_length=200)
    category_id     = models.ForeignKey(category, related_name="%(app_label)s_%(class)s_related", verbose_name="category id")
    analyzed        = models.BooleanField(_('has analyzed'), default=False)

    def __unicode__(self):
        return self.link_name
        
class article_page(models.Model):
    article_id      = models.ForeignKey(category, related_name="%(app_label)s_%(class)s_related", verbose_name="article id")
    link_name       = models.CharField(_('link name'), max_length=200)
    link_url        = models.CharField(_('link url'), max_length=200)
    analyzed        = models.BooleanField(_('has analyzed'), default=False)
    
    def __unicode__(self):
        return self.link_name
        
class pic(models.Model):
    article_id      = models.ForeignKey(category, related_name="%(app_label)s_%(class)s_related", verbose_name="article id")
    url             = models.CharField(_('pic url'), max_length=400)
    has_down        = models.BooleanField(_('has download'), default=False)
    save_path       = models.CharField(_('save path'), max_length=400)
    
    def __unicode__(self):
        return self.link_name